Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure correct SNS Subscription Filter Policy Scope update order #28572

Merged
merged 13 commits into from
Feb 21, 2023

Conversation

DanielVZ96
Copy link
Contributor

@DanielVZ96 DanielVZ96 commented Dec 24, 2022

Description

MessageAttributes subscription policy scope isn't compatible with nested subscription policies. Because of this, when updating from MessageAttributes to a MessageBody with nested subscription policies, since the order of update isn't guaranteed by the map implementation of the resource attributes, current implementation tries to set a nested subscription policy to a MessageAttributes scope before changing the scope to MessageBody. This results in an error.

This may result in an error the other way around: updating a nested subscription policy + MessageBody to a flat subscription policy + MessageAttributes . Since order isn't guaranteed, the scope may be updated to MessageAttributes before setting the flat subscription policy.

By chance this isn't currently happening, but it's still a risk if something changes in the underlying map implementation

References

Closes #28193.

Output from Acceptance Testing

$ make testacc TESTS=TestAccSNSTopicSubscription PKG=sns

...

@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/M Managed by automation to categorize the size of a PR. service/sns Issues and PRs that pertain to the sns service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. needs-triage Waiting for first response or review from a maintainer. labels Dec 24, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome @DanielVZ96 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@DanielVZ96
Copy link
Contributor Author

DanielVZ96 commented Dec 27, 2022

I'm unable to pay for Acc tests. If someone could help me with that, it would be much appreciated!

@DanielVZ96 DanielVZ96 marked this pull request as ready for review December 27, 2022 11:52
@vasiliyparfenov
Copy link
Contributor

Hi, @DanielVZ96! I've already created a PR for this. However, it seems like it's not a high priority issue. I guess if we could create an issue and link it in our PRs it might get more interactions from other users and we will get more attention

@DanielVZ96
Copy link
Contributor Author

@vasiliyparfenov ohh sorry I didn't notice! our approaches are a bit different so let's wait for reviews.

There are plenty of PRs already open. Since PRs are prioritized by the number of 👍 s we should get the most we can to prioritize this. I'll try to get some for both PRs.

@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 4, 2023
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccSNSTopicSubscription_' PKG=sns ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/sns/... -v -count 1 -parallel 3  -run=TestAccSNSTopicSubscription_ -timeout 180m
=== RUN   TestAccSNSTopicSubscription_basic
=== PAUSE TestAccSNSTopicSubscription_basic
=== RUN   TestAccSNSTopicSubscription_filterPolicy
=== PAUSE TestAccSNSTopicSubscription_filterPolicy
=== RUN   TestAccSNSTopicSubscription_filterPolicyScope
=== PAUSE TestAccSNSTopicSubscription_filterPolicyScope
=== RUN   TestAccSNSTopicSubscription_filterPolicyScope_policyNotSet
=== PAUSE TestAccSNSTopicSubscription_filterPolicyScope_policyNotSet
=== RUN   TestAccSNSTopicSubscription_deliveryPolicy
=== PAUSE TestAccSNSTopicSubscription_deliveryPolicy
=== RUN   TestAccSNSTopicSubscription_redrivePolicy
=== PAUSE TestAccSNSTopicSubscription_redrivePolicy
=== RUN   TestAccSNSTopicSubscription_rawMessageDelivery
=== PAUSE TestAccSNSTopicSubscription_rawMessageDelivery
=== RUN   TestAccSNSTopicSubscription_autoConfirmingEndpoint
=== PAUSE TestAccSNSTopicSubscription_autoConfirmingEndpoint
=== RUN   TestAccSNSTopicSubscription_autoConfirmingSecuredEndpoint
=== PAUSE TestAccSNSTopicSubscription_autoConfirmingSecuredEndpoint
=== RUN   TestAccSNSTopicSubscription_email
=== PAUSE TestAccSNSTopicSubscription_email
=== RUN   TestAccSNSTopicSubscription_firehose
=== PAUSE TestAccSNSTopicSubscription_firehose
=== RUN   TestAccSNSTopicSubscription_disappears
=== PAUSE TestAccSNSTopicSubscription_disappears
=== RUN   TestAccSNSTopicSubscription_Disappears_topic
=== PAUSE TestAccSNSTopicSubscription_Disappears_topic
=== CONT  TestAccSNSTopicSubscription_basic
=== CONT  TestAccSNSTopicSubscription_autoConfirmingEndpoint
=== CONT  TestAccSNSTopicSubscription_firehose
--- PASS: TestAccSNSTopicSubscription_autoConfirmingEndpoint (84.40s)
=== CONT  TestAccSNSTopicSubscription_Disappears_topic
--- PASS: TestAccSNSTopicSubscription_basic (93.62s)
=== CONT  TestAccSNSTopicSubscription_disappears
--- PASS: TestAccSNSTopicSubscription_Disappears_topic (99.74s)
=== CONT  TestAccSNSTopicSubscription_email
--- PASS: TestAccSNSTopicSubscription_disappears (98.02s)
=== CONT  TestAccSNSTopicSubscription_deliveryPolicy
--- PASS: TestAccSNSTopicSubscription_email (15.07s)
=== CONT  TestAccSNSTopicSubscription_rawMessageDelivery
--- PASS: TestAccSNSTopicSubscription_firehose (277.61s)
=== CONT  TestAccSNSTopicSubscription_redrivePolicy
--- PASS: TestAccSNSTopicSubscription_deliveryPolicy (93.06s)
=== CONT  TestAccSNSTopicSubscription_filterPolicyScope
--- PASS: TestAccSNSTopicSubscription_rawMessageDelivery (90.82s)
=== CONT  TestAccSNSTopicSubscription_filterPolicyScope_policyNotSet
--- PASS: TestAccSNSTopicSubscription_filterPolicyScope_policyNotSet (1.95s)
=== CONT  TestAccSNSTopicSubscription_autoConfirmingSecuredEndpoint
--- PASS: TestAccSNSTopicSubscription_autoConfirmingSecuredEndpoint (92.58s)
=== CONT  TestAccSNSTopicSubscription_filterPolicy
--- PASS: TestAccSNSTopicSubscription_filterPolicyScope (182.75s)
--- PASS: TestAccSNSTopicSubscription_redrivePolicy (138.88s)
--- PASS: TestAccSNSTopicSubscription_filterPolicy (96.23s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/sns	485.931s

@ewbankkit
Copy link
Contributor

@DanielVZ96 @vasiliyparfenov Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 0dd0781 into hashicorp:main Feb 21, 2023
@github-actions github-actions bot added this to the v4.56.0 milestone Feb 21, 2023
@DanielVZ96 DanielVZ96 deleted the b-sns-sub-filter-scope-order branch February 23, 2023 20:14
@DanielVZ96 DanielVZ96 restored the b-sns-sub-filter-scope-order branch February 23, 2023 20:22
@github-actions
Copy link

This functionality has been released in v4.56.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/sns Issues and PRs that pertain to the sns service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants